package com.example.myspringboot.controller;

import com.example.myspringboot.business.GachaService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/gacha")
public class GachaController {

    @Resource
    private GachaService gachaService;

    @RequestMapping("/view")
    public ModelAndView view() {
        ModelAndView modelAndView = new ModelAndView();
        List<Integer> up5 = Arrays.asList(1);
        List<Integer> up4 = Arrays.asList(10, 13, 22);
        List<Map<String, Object>> list = gachaService.gachaTenTimes(up5, up4);
        modelAndView.setViewName("gacha");
        modelAndView.addObject("list", list);
        return modelAndView;
    }
}
